package com.anydata.android.weatherforecast.weather.util;

import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class SpinnerUtil {
	
	public static void restoreCityPrefs(Context context, Spinner spinner,String[] items,int index) {
        ArrayAdapter<String> adapter=new ArrayAdapter<String>(context,android.R.layout.simple_spinner_item,items);
        spinner.setAdapter(adapter);
        spinner.setSelection(index);
	}
	
	public static void restoreSpinnerPref(Context context, Spinner spinner,String[] items,String savedItem) {
        ArrayAdapter<String> adapter=new ArrayAdapter<String>(context,android.R.layout.simple_spinner_item,items);
        spinner.setAdapter(adapter);
        int tmp_index = adapter.getPosition(savedItem);
        spinner.setSelection(tmp_index);
	}

}
